package com.myprocessing.box;

import com.myprocessing.gui.util.Coord;
import com.myprocessing.gui.util.image.ImageManager;

import processing.core.PImage;

public class ImageBox extends Box {

	protected PImage image;
	protected String imageStr;
	
	public void init() {
		super.init();
		
		image = ImageManager.getImage(imageStr);
//		image = pApplet.loadImage(imageStr);
		
		if(size == null){
			size = new Coord(image.width, image.height);
		}
		
		if(image == null){
			System.out.println(imageStr);
		}
	}
	
	public void drawBox(){
		image = ImageManager.getImage(imageStr);
		pApplet.image(image, position.getX(), position.getY(), size.getX(), size.getY());
	}
	
	public String getImageStr() {
		return imageStr;
	}

	public void setImageStr(String imageStr) {
		this.imageStr = imageStr;
	}

	public PImage getImage() {
		return image;
	}

	public void setImage(PImage image) {
		this.image = image;
	}

	
}
